package com.ruoyi.web.controller.ring.app;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ring.domain.RingStressChange;
import com.ruoyi.ring.service.IRingStressChangeService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

/**
 * 压力详情 （APP）
 */
@RestController
@RequestMapping("/ring/app/ring_stress_change")
public class AppStressChangeController extends BaseController
{
    @Resource
    private IRingStressChangeService ringStressChangeService;

    /**
     * 压力详情上报-app
     */
    @Log(title = "压力详情", businessType = BusinessType.INSERT)
    @PostMapping("/add-stress-change")
    public AjaxResult addStressChange(@RequestBody RingStressChange ringStressChange)
    {
        ringStressChange.setDailyValue(DateUtils.dateTime(DateUtils.YYYY_MM_DD, DateUtils.getDate()));
        ringStressChange.setEndTime(new Date());
        return toAjax(ringStressChangeService.insertRingStressChange(ringStressChange));
    }

}
